package tp.pr4.gui;

import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.border.TitledBorder;

import tp.pr4.RobotEngine;

public class LogView extends JPanel {
	RobotEngine rbt;
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private JTextArea logTA;
	
	/**
	 * Default constructor
	 */
	public LogView (RobotEngine rbt){
		this.rbt = rbt;
		this.setBorder(new TitledBorder("Log"));
		this.setLayout(new BorderLayout());
		build();
	}
	/**
	 * Builds the interface
	 */
	private void build(){
		logTA = new JTextArea();
		logTA.setRows(10);
		logTA.setText(rbt.getNavigationModule().showLocation());
		this.add(new JScrollPane(logTA),BorderLayout.CENTER);
		
	}
	/**
	 * Refreshes the status log textarea
	 */
	public void refresh(){
		logTA.setText(rbt.getNavigationModule().showLocation());
	}
	/**
	 * 
	 */
	public JTextArea getTextArea(){
		return this.logTA;
	}
}
